#ifndef CSERVER_CONTEXT_H_
#define CSERVER_CONTEXT_H_
#include <boost/asio/io_service.hpp>

#include <cserver/configfile.h>
#include <cserver/server.h>
#include <cserver/db.h>
#include <cserver/restapi.h>
#include <cserver/session/upstream.h>
#include <cserver/session/console.h>
#include <cserver/session/node.h>
#include <cserver/session/timer.h>

#include <memory>
namespace csrv{
	class Context;
	using ContextPtr = std::shared_ptr<Context>;

	class Context{
		public:
			Config config;
			boost::asio::io_service ios_aserver, ios_client;

			WallTimerPtr timer;
			ServerPtr server;
			DatabasePtr database;
			ConsolePtr console;
			LORAUpstreamPtr loraUpstream;
			NodeUdpPtr nodeUdp;
			RestApiPtr restapi;

			Context();
			~Context();

			void start();
			void stop();

			static ContextPtr make();
		private:

			Context(const Context&) = delete;
			Context& operator=(const Context&) =delete;
	};
}

#endif //end CSERVER_CONTEXT_H_
